============================================================================================================================
Modification Title: Custom Field: First Name

Version: 1.0

Author: John Briggs

Description: This modification will provide an additional field to your profile and threads.

Copyright:  2010 John Briggs. All Rights Reserved.

Compatibility: XMB 1.9.8 SP4

Install Note: Before adding this modification to your forum, you should back up all files related to this modification.

License Note: This modification is released under the GPL v3 License. A copy is provided with this software package.

Author Note: This modification is developed and released for use with XMB 1.9.8 SP4 which is provided by XMBGarage.com.
============================================================================================================================
=======
Step 1:
=======
====================================
Go To Administration Panel --> Insert Raw SQL
====================================
=========================
Paste Code and Submit Changes:
=========================

ALTER TABLE `$table_members` ADD `firstname` varchar(75) NOT NULL default '';

============================================================================================================================
=======
Step 2:
=======
===================
Edit File: editprofile.php
===================
==========
Find Code:
==========

    $sig = postedVar('newsig', 'javascript', ($SETTINGS['sightml']=='off'), TRUE, TRUE);

===============
Add Code Below:
===============

    // Custom Field: First Name Mod Begin
    $firstname = postedVar('newfirstname', 'javascript', TRUE, TRUE, TRUE);
    // Custom Field: First Name Mod End

==========
Find Code:
==========

$db->query("UPDATE ".X_PREFIX."members SET status='$status',

========================================
Find Code In-Line At End Of Above Query Statement:
========================================

 WHERE username='$user'");

================
Replace Code With:
================

, firstname='$newfirstname' WHERE username='$user'");

============================================================================================================================
=======
Step 3:
=======
=================
Edit File: member.php
=================
==========
Find Code:
==========

loadtemplates(

===============
Add Code Below:
===============

loadtemplates(
'member_profile_firstname',

==========
Find Code:
==========

                $sig = postedVar('sig', 'javascript', ($SETTINGS['sightml']=='off'), TRUE, TRUE);

===============
Add Code Below:
===============

                // Custom Field: First Name Mod Begin
                $firstname = postedVar('firstname', 'javascript', TRUE, TRUE, TRUE);
                // Custom Field: First Name Mod End

=======================
Find Code On 2 Occurrences:
=======================

$db->query("INSERT INTO ".X_PREFIX."members (username,

=============================
Find Code In-Line In Both Statements:
=============================

) VALUES ('$username',

================
Replace Code With:
================

, firstname) VALUES ('$username',

===================================
Find Code At End Of Above Query Statements:
===================================

)");

================
Replace Code With:
================

, '$firstname')");

==========
Find Code:
==========

        $emailblock = '';
        if ($memberinfo['showemail'] == 'yes') {
            eval('$emailblock = "'.template('member_profile_email').'";');
        }

===============
Add Code Below:
===============

        // Custom Field: First Name Mod Begin
        $firstnameblock = '';
        if (!empty($memberinfo['firstname'])) {
            $memberinfo['firstname'] = censor($memberinfo['firstname']);
            eval('$firstnameblock = "'.template('member_profile_firstname').'";');
        }
        // Custom Field: First Name Mod End

============================================================================================================================
=======
Step 4:
=======
=================
Edit File: memcp.php
=================
==========
Find Code:
==========

        $sig = postedVar('newsig', 'javascript', ($SETTINGS['sightml']=='off'), TRUE, TRUE);

===============
Add Code Below:
===============

        // Custom Field: First Name Mod Begin
        $firstname = postedVar('newfirstname', 'javascript', TRUE, TRUE, TRUE);
        // Custom Field: First Name Mod End

==========
Find Code:
==========

$db->query("UPDATE ".X_PREFIX."members SET $pwtxt

========================================
Find Code In-Line At End Of Above Query Statement:
========================================

 WHERE username='$xmbuser'");

================
Replace Code With:
================

, firstname='$newfirstname' WHERE username='$xmbuser'");

============================================================================================================================
=======
Step 5:
=======
=================================================
Skip This Part If You DO NOT Want This Field To Display In Posts.
=================================================
===================
Edit File: viewthread.php
===================
==========
Find Code:
==========

            if ($post['location'] != '') {
                $post['location'] = censor($post['location']);
                $location = '<br />'.$lang['textlocation'].' '.$post['location'];
            } else {
                $location = '';
            }

===============
Add Code Below:
===============

            // Custom Field: First Name Mod Begin
            $firstname = '';
            if (!empty($post['firstname'])) {
                $post['firstname'] = censor($post['firstname']);
                $firstname = '<br /><strong>'.$lang['firstname'].'</strong> '.$post['firstname'];
            }
            // Custom Field: First Name Mod End

==========
Find Code:
==========

            $location = '';
            $mood = '';

===============
Add Code Below:
===============

            // Custom Field: First Name Mod Begin
            $firstname = '';
            // Custom Field: First Name Mod End

============================================================================================================================
=======
Step 6:
=======
=======================
Edit File: lang/English.lang.php
=======================
============================
Add Code To End Of File Above  ?>
============================

// Custom Field: First Name Mod Begin
$lang['firstname'] = "First Name:";
// Custom Field: First Name Mod End

============================================================================================================================
=======
Step 7:
=======
==========================
Go To Admin Panel --> Templates
==========================
===========================
Edit Template: admintool_editprofile
===========================
==========
Find Code:
==========

<tr class="category">
<td colspan="2"><font color="$THEME[cattext]"><strong>$lang[texteditpro] - $lang[optional]</strong></font></td>
</tr>

===============
Add Code Below:
===============

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[firstname]</td>
<td bgcolor="$THEME[altbg2]"><input type="text" name="newfirstname" size="25" value="$member[firstname]" /></td>
</tr>

============================================================================================================================
=======
Step 8:
=======
==========================
Go To Admin Panel --> Templates
==========================
===========================
Edit Template: member_reg_optional
===========================
==========
Find Code:
==========

<tr>
<td colspan="2" class="category"><font color="$THEME[cattext]"><strong>$lang[textregister] - $lang[optional]</strong></font></td>
</tr>

===============
Add Code Below:
===============

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[firstname]</td>
<td bgcolor="$THEME[altbg2]"><input type="text" name="firstname" size="25" value="" /></td>
</tr>

============================================================================================================================
=======
Step 9:
=======
==========================
Go To Admin Panel --> Templates
==========================
=======================
Edit Template: memcp_profile
=======================
==========
Find Code:
==========

<tr>
<td colspan="2" class="category"><font color="$THEME[cattext]"><strong>$lang[texteditpro] - $lang[optional]</strong></font></td>
</tr>

===============
Add Code Below:
===============

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[firstname]</td>
<td bgcolor="$THEME[altbg2]"><input type="text" name="newfirstname" size="25" value="$member[firstname]" /></td>
</tr>

============================================================================================================================
========
Step 10:
========
======================================================
Skip This Step If You DO NOT Want This Field To Display In Viewthread.
======================================================
==========================
Go To Admin Panel --> Templates
==========================
========================
Edit Template: viewthread_post
========================
==========
Find Code:
==========

<font class="mediumtxt"><strong>$post[author]</strong></font>

===============
Add Code Below:
===============

$firstname

============================================================================================================================
========
Step 11:
========
==========================
Go To Admin Panel --> Templates
==========================
=======================
Edit Template: member_profile
=======================
==========
Find Code:
==========

<tr>
<td colspan="2" class="category"><font color="$THEME[cattext]"><strong>$lang[memcp_otherinfo]</strong></font></td>
</tr>

===============
Add Code Below:
===============

$firstnameblock

============================================================================================================================
========
Step 12:
========
==========================
Go To Admin Panel --> Templates
==========================
====================================
Create New Template: member_profile_firstname
====================================
========================
Add Code and Submit Changes:
========================

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[firstname]</td>
<td bgcolor="$THEME[altbg2]">$memberinfo[firstname]</td>
</tr>

============================================================================================================================
Enjoy!